/**
 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package de.hsmannheim.pepa.patientenportal.apanwep.model.impl;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import de.hsmannheim.pepa.patientenportal.apanwep.model.message;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

/**
 * The cache model class for representing message in entity cache.
 *
 * @author Cedric Nana
 * @see message
 * @generated
 */
public class messageCacheModel implements CacheModel<message>, Externalizable {
	@Override
	public String toString() {
		StringBundler sb = new StringBundler(13);

		sb.append("{messageId=");
		sb.append(messageId);
		sb.append(", eventactioncode=");
		sb.append(eventactioncode);
		sb.append(", eventdatetime=");
		sb.append(eventdatetime);
		sb.append(", eventoutcome=");
		sb.append(eventoutcome);
		sb.append(", sourceaddress=");
		sb.append(sourceaddress);
		sb.append(", eventid_id=");
		sb.append(eventid_id);
		sb.append("}");

		return sb.toString();
	}

	@Override
	public message toEntityModel() {
		messageImpl messageImpl = new messageImpl();

		messageImpl.setMessageId(messageId);

		if (eventactioncode == null) {
			messageImpl.setEventactioncode(StringPool.BLANK);
		}
		else {
			messageImpl.setEventactioncode(eventactioncode);
		}

		if (eventdatetime == null) {
			messageImpl.setEventdatetime(StringPool.BLANK);
		}
		else {
			messageImpl.setEventdatetime(eventdatetime);
		}

		messageImpl.setEventoutcome(eventoutcome);

		if (sourceaddress == null) {
			messageImpl.setSourceaddress(StringPool.BLANK);
		}
		else {
			messageImpl.setSourceaddress(sourceaddress);
		}

		messageImpl.setEventid_id(eventid_id);

		messageImpl.resetOriginalValues();

		return messageImpl;
	}

	@Override
	public void readExternal(ObjectInput objectInput) throws IOException {
		messageId = objectInput.readLong();
		eventactioncode = objectInput.readUTF();
		eventdatetime = objectInput.readUTF();
		eventoutcome = objectInput.readLong();
		sourceaddress = objectInput.readUTF();
		eventid_id = objectInput.readLong();
	}

	@Override
	public void writeExternal(ObjectOutput objectOutput)
		throws IOException {
		objectOutput.writeLong(messageId);

		if (eventactioncode == null) {
			objectOutput.writeUTF(StringPool.BLANK);
		}
		else {
			objectOutput.writeUTF(eventactioncode);
		}

		if (eventdatetime == null) {
			objectOutput.writeUTF(StringPool.BLANK);
		}
		else {
			objectOutput.writeUTF(eventdatetime);
		}

		objectOutput.writeLong(eventoutcome);

		if (sourceaddress == null) {
			objectOutput.writeUTF(StringPool.BLANK);
		}
		else {
			objectOutput.writeUTF(sourceaddress);
		}

		objectOutput.writeLong(eventid_id);
	}

	public long messageId;
	public String eventactioncode;
	public String eventdatetime;
	public long eventoutcome;
	public String sourceaddress;
	public long eventid_id;
}